package com.hlk.hlk_blog.service;


import com.hlk.hlk_blog.dao.UserMapper;
import com.hlk.hlk_blog.entity.User;
import com.hlk.hlk_blog.util.MD5Utils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by limi on 2017/10/15.
 */
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;

    @Override
    public User findUserById(Long id) {
        return userMapper.findUserById(id);
    }

    @Override
    public String getUserName(String username) {
        return userMapper.getUserName(username);
    }

    @Override
    public User login(String username, String password) {
        return userMapper.login(username, MD5Utils.code(password));
    }

    @Override
    public boolean insertUser(User user) {
        return userMapper.insertUser(user);
    }

    @Override
    public int updateUser(User user) {
        return userMapper.updateUser(user);
    }
}
